import { _decorator, Component, Label, Node, resources, Sprite, SpriteFrame } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('RewardCellItem')
export class RewardCellItem extends Component {

    @property(Label)
    numLabel;
    @property(Sprite)
    sp:Sprite;
    @property(Sprite)
    qualityCellBg:Sprite

    init(data) {
        console.log(data.imgPath,"data.imgPath");
        this.numLabel.string = "X" + data.count;

        resources.load(`${data.imgPath}/spriteFrame`, SpriteFrame, (err, res) => {
            console.log(res,"res");
            this.sp.spriteFrame=res
        })

        if (data.quality!=undefined) {
            resources.load(`qualityCellBg/${data.quality}/spriteFrame`,SpriteFrame,(err,res)=>{
                this.qualityCellBg.spriteFrame=res;
            })
        }
    }

}




